<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

@if (messages && messages.length > 0) {
    <div
        class="banner-container px-4 py-3 mb-5 flex flex-col justify-between text-sm"
        [ngClass]="{ 'border-t': showBorder, 'border-b': showBorder }">
        <div
            class="flex gap-4"
            [ngClass]="{ 'items-start': messages.length > 1, 'items-center': messages.length === 1 }">
            @if (showErrorIcon) {
                <i class="fa fa-exclamation-triangle error-color fa-2x"></i>
            }
            @if (messages.length === 1) {
                <div class="error-banner-message">{{ messages[0] }}</div>
            } @else {
                <ul>
                    @for (message of messages; track message) {
                        <li class="error-banner-message">{{ message }}</li>
                    }
                </ul>
            }
        </div>
        @if (allowDismiss) {
            <div class="flex flex-1 mt-auto justify-end w-full">
                <button mat-flat-button class="error-button" (click)="dismissClicked()">Dismiss</button>
            </div>
        }
    </div>
}
